package com.petadoption.serverclient.controller;

import com.petadoption.serverclient.entity.Deliver;
import com.petadoption.serverclient.service.IDeliverService;
import com.petadoption.serverclient.utils.Result;
import com.petadoption.serverclient.vo.PetVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 汪仕杰
 * @since 2023-08-28
 */
@RestController

public class DeliverController {
    @Resource
    private IDeliverService deliverService;

    @Resource
    private Result result;

    //根据宠物ID查询送养人
    @RequestMapping("/deliver/{id}")
    public Result<PetVO> findDeliver(@PathVariable Integer id) {
        Deliver deliver = deliverService.findDeliverByPetId(id);
        if (null != deliver) return result.success("当前宠物送养人", deliver);
        return result.success("该宠物暂无送养人");
    }

}
